package com.navinfo.platform.dataanalysis.dto;

import lombok.Data;
import org.apache.spark.sql.Row;
import org.bson.Document;

import java.io.Serializable;

@Data
public class MileageOilDto implements Serializable {
//    terminalId:1 ,mMilage:1, fuel:1, date:1

    private long terminalId;
    private double mileage;
    private double fuel;
    private String date;

    public static MileageOilDto parseRow(Document document){
        MileageOilDto mileageOilDto = new MileageOilDto();
        mileageOilDto.setDate("2018-10-02");
        mileageOilDto.setFuel(document.getDouble("fuel"));
        mileageOilDto.setMileage(document.getDouble("mMilage"));
        mileageOilDto.setTerminalId(document.getLong("terminalId"));
        return mileageOilDto;
    }

}
